#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
const int MAXN=32768;
const double INF=100000004.25;
struct node {
	double l;
	double r;
	bool isOK() {
		if (l==r && l==0) return false;
		return true;
	}
};
node pre[MAXN];
node now[MAXN];
node res[MAXN];
node mdzz[MAXN];
int pre_cnt,now_cnt,res_cnt,mdzz_cnt;
node Jiao(node a, node b) {
	node tmp;
	if (a.l > b.l) swap(a,b);
	if (a.r<b.l) {
		tmp.l=0;
		tmp.r=0;
	}
	else if (a.r>b.r){
		tmp.l=b.l;
		tmp.r=b.r;
	}
	else {
		tmp.l=b.l;
		tmp.r=a.r;
	}
	return tmp;
}
bool flag;
void start(double a, double b, double s1, double s2) {
	now_cnt=0;
	node tmp;
	double l,r;
	double z=(s2-s1)/b;
	double k=1;
	r=s1/(k*(a+b)-b); 
	l=s2/(k*(a+b)); //
	if (r<z) {
		flag=false;
		return;
	}
	while (r>=z) {
		if (l>=z) {
			tmp.l=l; tmp.r=r;
			now[now_cnt++]=tmp;
		}
		else {
			tmp.l=z; tmp.r=r;
			now[now_cnt++]=tmp;
		}
		k++;
		r=s1/(k*(a+b)-b);
		l=s2/(k*(a+b)); //
	}
//	printf("-----------\n");
//	for (int i=0; i<now_cnt; ++i) printf("%lf %lf\n", now[i].l, now[i].r);
//	printf("-----------\n");
	res_cnt=0;
	for (int i=0; i<now_cnt; ++i) {
		for (int j=0; j<pre_cnt; ++j) {
			tmp=Jiao(now[i],pre[j]);
			if (tmp.isOK()) {
				res[res_cnt++]=tmp;
			}
		}
	}
//	swap(pre,res); 
	for (int i=0; i<pre_cnt; ++i) {
		mdzz[i]=pre[i];
		mdzz_cnt=pre_cnt;
	}
	for (int i=0; i<res_cnt; ++i) {
		pre[i]=res[i];
		pre_cnt=res_cnt;
	}
	for (int i=0; i<mdzz_cnt; ++i) {
		res[i]=mdzz[i];
		res_cnt=mdzz_cnt;
	}
//	swap(pre_cnt, res_cnt);
}
int main() {
	int T;
	cin>>T;
	int n;
	double a,b,s1,s2;
	node tmp;
	while (T--) {
		scanf("%d", &n);
		pre_cnt=0;
		tmp.l=0.0; tmp.r=INF;
		pre[pre_cnt++]=tmp;
		flag=true;
		for (int i=0; i<n; ++i) {
			scanf("%lf%lf%lf%lf", &a, &b, &s1, &s2);
			if (flag) {
				start(a,b,s1,s2);
			}
		}
		if (!flag || !pre_cnt) printf("IMPOSSIBLE\n");
		else {
			double zz=INF;
			for (int i=0; i<pre_cnt; ++i) {
				if (pre[i].l<zz) zz=pre[i].l;
			}
			printf("%0.4lf\n", zz);
		}
	}
	return 0;
}
/*
100
2
1 3 1 2
1 3 3 4
*/
